package com.ruoyi.system.service.impl;

import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.SysMonitorPoint;
import com.ruoyi.system.mapper.SysMonitorPointMapper;
import com.ruoyi.system.service.ISysMonitorPointService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysMonitorPointServiceImpl implements ISysMonitorPointService {

    @Autowired
    private SysMonitorPointMapper sysMonitorPointMapper;

    @Override
    public void create(SysMonitorPoint sysMonitorPoint) {
        sysMonitorPointMapper.create(sysMonitorPoint);
    }

    @Override
    public List<SysMonitorPoint> list(SysMonitorPoint sysMonitorPoint) {
        return sysMonitorPointMapper.list(sysMonitorPoint);
    }

    @Override
    public void delete(Integer id) {
        sysMonitorPointMapper.delete(id);
    }

    @Override
    public void update(SysMonitorPoint sysMonitorPoint) {
        sysMonitorPointMapper.update(sysMonitorPoint);
    }

    @Override
    public String importExcel(List<SysMonitorPoint> sysMonitorPoints, boolean updateSupport, String operName) {
        if (StringUtils.isNull(sysMonitorPoints) || sysMonitorPoints.size() == 0) {
            throw new ServiceException("导入用户数据不能为空！");
        }
        sysMonitorPointMapper.insertBatch(sysMonitorPoints);
        return "成功";
    }
}
